import 'package:backend.core/core/domain/entities/google_play/google_play_transaction_revocation_reason.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_transaction_revocation_reason.dart';

abstract class CreateGooglePlayTransactionRevocationReasonFromApiOne {
  GooglePlayTransactionRevocationReason call({
    required GooglePlayApiTransactionRevocationReason apiRevocationReason,
  });
}

class CreateGooglePlayTransactionRevocationReasonFromApiOneImpl
    implements CreateGooglePlayTransactionRevocationReasonFromApiOne {
  const CreateGooglePlayTransactionRevocationReasonFromApiOneImpl();

  @override
  GooglePlayTransactionRevocationReason call({
    required GooglePlayApiTransactionRevocationReason apiRevocationReason,
  }) {
    switch (apiRevocationReason) {
      case GooglePlayApiTransactionRevocationReason.other:
        return GooglePlayTransactionRevocationReason.other;
      case GooglePlayApiTransactionRevocationReason.remorse:
        return GooglePlayTransactionRevocationReason.remorse;
      case GooglePlayApiTransactionRevocationReason.notReceivedPurchase:
        return GooglePlayTransactionRevocationReason.notReceivedPurchase;
      case GooglePlayApiTransactionRevocationReason.defectivePurchase:
        return GooglePlayTransactionRevocationReason.defectivePurchase;
      case GooglePlayApiTransactionRevocationReason.accidentalPurchase:
        return GooglePlayTransactionRevocationReason.accidentalPurchase;
      case GooglePlayApiTransactionRevocationReason.fraud:
        return GooglePlayTransactionRevocationReason.fraud;
      case GooglePlayApiTransactionRevocationReason.friendlyFraud:
        return GooglePlayTransactionRevocationReason.friendlyFraud;
      case GooglePlayApiTransactionRevocationReason.chargeback:
        return GooglePlayTransactionRevocationReason.chargeback;
    }
  }
}
